<include file="Common/header" />

<div class="topbar">
    <nav class="navbar navbar-inverse" role="navigation">
        <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand txt-white" href="{:U('Index/index')}">api文档管理</a>
        </div>
        <!-- <ol class="breadcrumb">
            <li><a href="#">Home</a></li>
            <li class="active">十一月</li>
        </ol> -->
        <ul class="nav navbar-nav navbar-right"> 
            <li><a href="{:U('Home/Index/createProject')}" class="btn btn-primary create-project glyphicon glyphicon-plus">创建项目</a></li> 
            <li><a href="#"><span class="glyphicon glyphicon-user"></span> {$login_user.username}</a></li> 
            <li><a href="{:U('Passport/exist')}"><span class="glyphicon glyphicon-log-in"></span> 注销</a></li> 
        </ul> 
        </div>
    </nav>
</div>
<div class="body">
    <div class="col-md-2 sidebar">
        <ul id="main-nav" class="nav nav-tabs nav-stacked" style="">

            <if condition="$active_menu eq index">
                <li class="active">
            <else />
                <li>
            </if>
                <a href="{:U('Home/Project/index',['pid'=>$project_id])}">
                    <i class="glyphicon glyphicon-th-large"></i>
                    项目总览         
                </a>
            </li>

            <if condition = "$active_menu['one'] eq group">
            <li class="active">
                <a href="#groupSetting" class="nav-header" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    分组管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="groupSetting" class="nav nav-list collapse secondmenu in active" aria-expanded="true">
                    <if condition = "($active_menu['two'] eq add) AND ($self_auth neq 'tour')">
                    <li class="active"><a href="{:U('Home/Project/addGroup',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建分组</a></li>
                    <elseif condition = "$self_auth neq 'tour'"/>
                    <li><a href="{:U('Home/Project/addGroup',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建分组</a></li>
                    </if>
                    <if condition = "$active_menu['two'] eq glist">
                    <li class="active"><a href="{:U('Home/Project/groupList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;分组列表</a></li>
                    <else />
                    <li><a href="{:U('Home/Project/groupList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;分组列表</a></li>
                    </if>
                </ul>
            <else />
            <li>
                <a href="#groupSetting" class="nav-header collapsed" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    分组管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="groupSetting" class="nav nav-list collapse secondmenu" style="height: 0px;">
                    <if condition = "$self_auth neq 'tour'">
                    <li><a href="{:U('Home/Project/addGroup',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建分组</a></li>
                    </if>
                    <li><a href="{:U('Home/Project/groupList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;分组列表</a></li>
                </ul>
            </li>
            </if>

            <if condition = "$active_menu['one'] eq api">
            <li class="active">
                <a href="#projectSetting" class="nav-header" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    接口管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="projectSetting" class="nav nav-list collapse secondmenu in active" aria-expanded="true">
                    <if condition = "($active_menu['two'] eq add) AND ($self_auth neq 'tour')">
                    <li class="active"><a href="{:U('Home/Project/addApi',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建接口</a></li>
                    <elseif condition="$self_auth neq 'tour'"/>
                    <li><a href="{:U('Home/Project/addApi',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建接口</a></li>
                    </if>
                    <if condition = "$active_menu['two'] eq apilist">
                    <li class="active"><a href="{:U('Home/Project/apiList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;接口列表</a></li>
                    <else />
                    <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;接口列表</a></li>
                    </if>
                    <if condition = "($active_menu['two'] eq sign) AND ($self_auth neq 'tour')">
                    <li class="active"><a href="{:U('Home/Project/signManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-wrench"></i>&nbsp;签名算法管理</a></li>
                    <elseif condition="$self_auth neq 'tour'"/>
                    <li><a href="{:U('Home/Project/signManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-wrench"></i>&nbsp;签名算法管理</a></li>
                    </if>
                </ul>
            </li>
            <else />
            <li>
                <a href="#projectSetting" class="nav-header collapsed" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    接口管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="projectSetting" class="nav nav-list collapse secondmenu" style="height: 0px;">
                    <if condition = "$self_auth neq 'tour'">
                    <li><a href="{:U('Home/Project/addApi',['pid'=>$project_id])}"><i class="glyphicon glyphicon-plus"></i>&nbsp;新建接口</a></li>
                    </if>
                    <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id])}"><i class="glyphicon glyphicon-th-list"></i>&nbsp;接口列表</a></li>
                    <if condition = "$self_auth neq 'tour'">
                    <li><a href="{:U('Home/Project/signManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-wrench"></i>&nbsp;签名算法管理</a></li>
                    </if>
                </ul>
            </li>
            </if>

            <if condition = "($active_menu['one'] eq 'project') AND (($self_auth eq 'owner') OR ($self_auth eq 'admin'))">
            <li class="active">
                <a href="#memberSetting" class="nav-header" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    项目管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="memberSetting" class="nav nav-list collapse secondmenu in active">
                    <if condition = "$active_menu['two'] eq memberManage">
                    <li class="active"><a href="{:U('Home/Project/memberManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-user"></i>&nbsp;成员管理</a></li>
                    <else />
                    <li><a href="{:U('Home/Project/memberManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-user"></i>&nbsp;成员管理</a></li>
                    </if>
                    <if condition = "$active_menu['two'] eq projectInfo">
                    <li class="active"><a href="{:U('Home/Project/projectInfo',['pid'=>$project_id])}"><i class="glyphicon glyphicon-book"></i>&nbsp;项目信息</a></li>
                    <else />
                    <li><a href="{:U('Home/Project/projectInfo',['pid'=>$project_id])}"><i class="glyphicon glyphicon-book"></i>&nbsp;项目信息</a></li>
                    </if>
                    <if condition = "$active_menu['two'] eq projectManage">
                    <li class="active"><a href="{:U('Home/Project/projectManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-cog"></i>&nbsp;项目管理</a></li>
                    <else />
                    <li><a href="{:U('Home/Project/projectManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-cog"></i>&nbsp;项目管理</a></li>
                    </if>
                </ul>
            </li>
            <elseif condition = "($self_auth eq 'owner') OR ($self_auth eq 'admin')"/>
            <li>
                <a href="#memberSetting" class="nav-header collapsed" data-toggle="collapse">
                    <i class="glyphicon glyphicon-cog"></i>
                    项目管理
                       <span class="pull-right glyphicon glyphicon-chevron-toggle"></span>
                </a>
                <ul id="memberSetting" class="nav nav-list collapse secondmenu" style="height: 0px;">
                    <li><a href="{:U('Home/Project/memberManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-user"></i>&nbsp;成员管理</a></li>
                    <li><a href="{:U('Home/Project/projectInfo',['pid'=>$project_id])}"><i class="glyphicon glyphicon-book"></i>&nbsp;项目信息</a></li>
                    <li><a href="{:U('Home/Project/projectManage',['pid'=>$project_id])}"><i class="glyphicon glyphicon-cog"></i>&nbsp;项目管理</a></li>
                </ul>
            </li>
            </if>

            <!-- <li>
                <a href="#">
                    <i class="glyphicon glyphicon-credit-card"></i>
                    未定义菜单        
                </a>
            </li> -->
        </ul>
    </div>
    <div class="col-md-offset-2 col-md-10">
        <div class="hd">
            <div class="pull-left"><b>{$bread}</b></div>
            <div class="pull-right">
                <if condition="$apibtn eq 1">
                <a class="btn btn-xs btn-warning btn-test" target="_blank" href="{:U('Home/Project/testApi',['pid'=>$project_id,'aid'=>$api_info[api_id]])}"><i class="glyphicon glyphicon-paperclip"></i>&nbsp;测试</a>
                <if condition="$self_auth neq 'tour'">
                <a class="btn btn-xs btn-primary btn-copy" href="{:U('Home/Project/addApi',['pid'=>$project_id,'aid'=>$api_info[api_id]])}"><i class="glyphicon glyphicon-file"></i>&nbsp;复制</a>
                <a class="btn btn-xs btn-info btn-edit" href="{:U('Home/Project/editApi',['pid'=>$project_id,'aid'=>$api_info[api_id]])}"><i class="glyphicon glyphicon-pencil"></i>&nbsp;修改</a>
                <a class="btn btn-xs btn-danger btn-delete" href="javascript:;" onclick="deleteApi({$api_info[api_id]})"><i class="glyphicon glyphicon-remove"></i>&nbsp;&nbsp;删除</a>
                </if>
                </if>
            </div>
        </div>
        <block name="main">
        </block>
    </div>
</div>
<script>
function deleteApi(api_id){
    if(confirm('删除后将无法恢复，确定要这么做吗？')){
        var url = '{:U("Home/Project/deleteApi",["pid"=>$project_id,"aid"=>$api[api_id]])}';
        $.post(url,{pid:{$project_id},aid:api_id},function(rs){
            if(rs.success){
                showMessage('success',rs.msg,rs.url);
            }
            else{
                showMessage('erroe',rs.msg,rs.url);
            }
        })
    }
}
</script>
<include file="Common/footer" />